package global

import (
	"context"
	"github.com/gorilla/websocket"
	"github.com/redis/go-redis/v9"
	"gorm.io/gorm"
)

var (
	DB  *gorm.DB
	Rdb *redis.Client
	Ctx = context.Background()
)

var Upgrader = websocket.Upgrader{
	ReadBufferSize:  1024,
	WriteBufferSize: 1024,
}

var ClientMap map[int64]Node = make(map[int64]Node)
var ClientMaps map[int]Node = make(map[int]Node)

type Node struct {
	Conn *websocket.Conn
	Data chan []byte
}

type Message struct {
	UserId  int    `json:"user_id"`
	DistId  int    `json:"dist_id"`
	Content string `json:"content"`
	Cmd     int    `json:"cmd"`
}
